<?php
namespace Food\Controller;

class WapController extends \Common\Controller\BaseController{

	public function index(){
		$Food=D('FoodView');
		$id = I('id');

		if ($id) {
			$map['fcid'] = $id;
		}
		
		$count  = $Food->count();// 查询满足要求的总记录数
		$Page   = new \Com\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数

		// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
		$list = $Food->where($map)->limit($Page->firstRow.','.$Page->listRows)->order('fid desc')->select();

		$data = array(
			'list'  => $list,
			'page'  => $Page->show(),
		);
		$this->assign($data);
		$this->display();
	}
}